<template>
  <div class="h-panel">
    <PaasTitleBar></PaasTitleBar>
    <div class="h-panel-body bottom-line">
      <Form ref="form" :validOnChange="true" :showErrorTip="true" labelPosition="left" :labelWidth="110" :rules="vRules"
        :model="model" mode="twocolumn">
        <FormPageSelect label="所属团队" prop="groupMember" v-model="model.groupMember" url="/srgroupmember/select">
        </FormPageSelect>
        <FormSelect label="后台类型" prop="serverType" v-model="model.serverType" params="ServerType"></FormSelect>
        <FormSelect label="UI类型" prop="uiType" v-model="model.uiType" params="UiType"></FormSelect>
        <FormInput label="项目名称" prop="name" v-model="model.name"></FormInput>
        <FormInput label="包名称" prop="pkgName" v-model="model.pkgName"></FormInput>
        <FormPageSelect label="数据库" prop="dbType" v-model="model.dbType" url="/sidatabasetype/select"></FormPageSelect>
        <FormInput label="驱动地址" prop="dataSource" v-model="model.dataSource"></FormInput>
        <FormInput label="创建用户" v-model="model.crtOpr" readonly="true"></FormInput>
        <FormInput label="创建时间" v-model="model.crtTs" readonly="true"></FormInput>
        <FormItem label="清除历史">
          <h-switch v-model="model.deleteHis" :small="true">
          </h-switch>
        </FormItem>
      </Form>
    </div>
    <PaasButtonBar></PaasButtonBar>
  </div>
</template>

<script>
export default {
  async mounted() {
    let id = this.$route.query.id;
    if (!!id) {
      this.model = await this.$store.dispatch("getFormData", id);
    }
  },
  data() {
    return {
      model: {
        serverType: "1",
        uiType: "1",
        crtOpr: "",
        crtTs: "",
        dbType: "",
        groupMember: "",
        name: "",
        pkgName: "",
      },
      vRules: {
        required: [
          "serverType",
          "uiType",
          "dbType",
          "groupMember",
          "name",
          "pkgName",
        ],
      },
    };
  },
  deactivated() {
    this.$destroy(true);
  },
};
</script>
